<template>
	<view class="bg-white" style="background: #AEE2DA;min-height: 100vh;">
		<cu-custom bgColor="bg-newblue" mesmes="true" :isBack="true">
			<block slot="content">{{text}}</block>
		</cu-custom>
		<view style="width: 100%;height: 70upx;"></view>
		<view style="clear: both;"></view>
		<view :style="{background:'url('+Imgbase+'/app_express_top2s.png) no-repeat','background-size':'100% 100%',}"
			style="width: 96%;margin-left: 2%;height:150upx;
		position: absolute;">
			<image :src="Imgbase + '/app_express_top1.png'" mode="widthFix" v-if="expressno != 0"
				style="position: absolute;width: 50%;left: 25%;top: -35%;">
			</image>
			<view style="clear: both;"></view>
		</view>

		<view class="cu-card article"
			:style="{background:'url('+Imgbase+'/1zhan_app_index_c_middles.png) ','background-size':'100%',}"
			style="position: relative;width: 96%;margin-left: 2%;margin-top: 100upx;padding-left: 40upx;min-height: 400rpx;">
			<view class="font-weight-500 flex-between padding-bottom-15">
				<view class="">
					物流单号：<text class="font-32">{{expressno}}</text>
				</view>

				<view class="w-150 h-50 flex-center radius-8 fff margin-right-50 font-26" style="background-color: #F78D51;" @click="copyex()">
					复制
				</view>
			</view>

			<block v-for="(item,index) in goodlist">
				<view class="cu-item shadow"
					style="position: relative;width: 27%;float: left;padding-bottom: 0rpx;margin-left: 26rpx;margin-right: 0rpx;margin-top: 0rpx;margin-bottom: 20rpx;">
					<view class="image" style="width: 100%;">
						<image :src="item.adimage" mode="widthFix" style="min-height: 80px;"
							@click="viewImages(item.adimage)"></image>
						<view class=" text-white bg-black"
							style="margin-top: -40%;display: block;line-height: 30upx;opacity: 0.7;padding-left: 15rpx;">
							<view style="clear: both;"></view>
							<text class="text-sm"
								style="width: 100%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
								{{item.goods_name}}
							</text>
							<view style="clear: both;"></view>
							<text class="text-sm" style="width: 100%;">
								{{item.reword_type_name}}赏
							</text>
							<view style="clear: both;"></view>
						</view>
					</view>
				</view>
			</block>
			<view style="clear: both;"></view>
			<!-- <view v-if="desc.updateT != ''" style="width: 90%;">
				<view class="fl">
					<image :src="desc.logo" mode="aspectFill" style="width: 60upx;height: 60upx;margin-left: 35upx;">
					</image>
				</view>
				<view class="text-df fl" style="padding-left: 25upx;padding-top: 12upx;">
					{{desc.expName}}
				</view>
				<view class="text-df fl" style="padding-left: 25upx;padding-top: 16upx;">
					{{expressno}}
				</view>
				<view class="text-df fr" style="padding-right: 35upx;padding-top: 16upx;">
					复制
				</view>
				<view style="clear: both;"></view>
				<view style="width: 100%;height: 20upx;"></view>
				<view class="" v-for="(item,index) in list" :key="index">
					<view class="cu-timeline" style="background-color: inherit;">
						<view class="cu-item text-blue">
							<view class="bg-cyan content">
								<text>{{item.time}}</text> {{item.status}}
							</view>
						</view>
					</view>
					<view style="clear: both;"></view>
				</view>
			</view> -->
			<view v-if="expressno != 0"
				style="width: 100%;height: 600upx;display: flex;align-items: center;justify-content: center;flex-direction:column">
				<image :src="Imgbase + '/nonepublisher.png'" mode="widthFix" style="width: 240upx;"></image>
				<view>我们正在努力打包啦</view>
				<view>请耐心等待物流信息哦~</view>
			</view>
		</view>
		<view style="clear: both;"></view>
		<view
			:style="{background:'url('+Imgbase+'/1zhan_app_index_c_bottoms.png) no-repeat','background-size':'100% 100%',}"
			style="width: 96%;margin-left: 2%;height:140upx;" class="cu-card article">
		</view>
		<view style="width: 100%;height: 50upx;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Imgbase: getApp().globalData.Imgbase,
				desc: [],
				goodlist: [],
				list: [],
				expressno: '',
				uid: 0,
				text: ''
			};
		},
		onLoad(options) {
			let _this = this;
			this.expressno = options.expressno;
			this.uid = options.uid;
			if (options.expressno == 0) {
				this.text = '待发货'
			} else {
				this.text = '物流信息'
			}
			uni.request({
				url: _this.$globals.apibase + '/api/Express/searchExpress',
				data: {
					token: uni.getStorageSync('token'),
					expressno: options.expressno,
					user_deliver_id: options.uid
				},
				method: 'POST',
				header: {
					'content-type': 'application/json'
				},
				success: (res) => {
					if (res.data.code == '401') {
						uni.setStorageSync('token', '');
						_this.$uniApi.trylogin();
					}
					if (res.data.code == '1') {
						_this.desc = res.data.data.desc;
						_this.goodlist = res.data.data.goodlist;
						_this.list = res.data.data.list;
					}
					if (res.data.code == '0') {
						uni.showToast({
							icon: 'none',
							title: res.data.msg
						});
					}
				}
			});
		},
		methods: {
			copyex(){
				let _this = this
				uni.setClipboardData({
					data: _this.expressno,
					success: function () {
						console.log('success');
					}
				});
			},
			viewImages(adimages) {
				let images = [];
				images = images.concat(adimages);
				uni.previewImage({
					urls: images,
					current: 0
				});
			},
		}
	}
</script>

<style>
	.fl {
		float: left;
	}

	.fr {
		float: right;
	}
</style>